﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using CMS.BLL;

public partial class Controls_News_ctrProjectDetail : System.Web.UI.UserControl
{
    int nCurentLanguage = Support.GetCurrentLanguage() - 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.GetPage();
        }
    }

    private void GetPage()
    {
        //try
        //{
            int nPageID = ConvertData.ConvertToInt(Request.QueryString[Config.PAGE_ID]);
            News objProdject = new News();
            objProdject.LoadById(nPageID);

            switch (nCurentLanguage)
            {
                case 1:
                    lblTitleService.Text = ConvertData.ConvertToString(objProdject.Data.NewsTitle1);
                    ltrContentServices.Text = ConvertData.ConvertToString(objProdject.Data.InitContent1);
                    ltrInitContent.Text = ConvertData.ConvertToString(objProdject.Data.InitContent1);
                    lblMapStaticDetails.Text = ConvertData.ConvertToString(objProdject.Data.NewsTitle1);
                    break;
                case 2:
                    lblTitleService.Text = ConvertData.ConvertToString(objProdject.Data.NewsTitle2);
                    ltrContentServices.Text = ConvertData.ConvertToString(objProdject.Data.InitContent2);
                    ltrInitContent.Text = ConvertData.ConvertToString(objProdject.Data.InitContent2);
                    lblMapStaticDetails.Text = ConvertData.ConvertToString(objProdject.Data.NewsTitle2);
                    break;
                case 3:
                    lblTitleService.Text = ConvertData.ConvertToString(objProdject.Data.NewsTitle3);
                    ltrContentServices.Text = ConvertData.ConvertToString(objProdject.Data.InitContent3);
                    ltrInitContent.Text = ConvertData.ConvertToString(objProdject.Data.InitContent3);
                    lblMapStaticDetails.Text = ConvertData.ConvertToString(objProdject.Data.NewsTitle3);
                    break;
            }
            string ImgUrl = ConvertData.ConvertToString(objProdject.Data.Image);
            if (ImgUrl == "")
            {
                imgServices.ImageUrl = Config.ROOT + Config.IMAGE_NO_IMAGE_FRONTEND;

            }
            else { imgServices.ImageUrl = Config.ROOT + Config.IMAGE_NEWS_DEFAULT_UPLOAD + ImgUrl; }
        //}
        //catch
        //{
        //    string sURL = Config.ROOT + Pages.FrontEnds.HOME;
        //    Response.Redirect(sURL);
        //}
    }
}